package com.lin.controller.user.set;

import com.lin.common.result.Result;
import com.lin.entity.MessageSet;
import com.lin.service.set.MessageSetService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 消息设置接口
 */

@RestController
@RequestMapping("/messageSet")
@Api(tags = "消息设置接口")
@Slf4j
public class MessageSetController {

    @Autowired
    MessageSetService messageSetService;

    @GetMapping
    @ApiOperation("获取消息设置")
    public Result<MessageSet> getMessageSet(@RequestParam Integer userId){
        log.info("获取消息设置 ：{}",userId);
        MessageSet messageSet = messageSetService.getMessageSet(userId);
        return Result.success(messageSet);
    }

    @PostMapping
    @ApiOperation("更新用户消息设置")
    public Result updateMessageSet(@RequestBody MessageSet messageSet){
        messageSetService.updateMessageSet(messageSet);
        return Result.success();
    }
}
